|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.caucho.xpath.Env
Global and local variable environment. The April XSLT draft introduces global and local variables. The Env class contains those bindings.
Because this class exists only to support XSL, it makes a number of assumptions that would be invalid for a typical API. Specifically, the variable names must be interned strings, i.e. variable matching uses '==', not equals.
Local variables are handled like a stack. They are pushed and popped as necessary. The top variables shadow bottom variables.
In other words, although the API somewhat resembles a HashMap, it can't be used as a generic hash map.
| Constructor Summary | |
Env()
|
|
| Method Summary | |
void |
addFunction(java.lang.String name,
java.lang.Object fun)
Adds and extension function |
void |
addVar(java.lang.String name,
java.lang.Object value)
Adds the value associated with name. |
void |
addVar(java.lang.String name,
com.caucho.xpath.expr.Var value)
Adds the value associated with name. |
void |
clear()
Clears all values in the local environment. |
void |
free()
|
java.lang.Object |
getCache(java.lang.Object key)
|
Node |
getContextNode()
Gets the context node. |
int |
getContextPosition()
Returns the position of the context node. |
int |
getContextSize()
Returns the number of nodes in the context list. |
Node |
getCurrentNode()
Gets the current node. |
XPathFun |
getFunction(java.lang.String name)
Returns the named function. |
Document |
getOwnerDocument()
Returns a document for creating nodes. |
int |
getPositionIndex()
|
com.caucho.xpath.pattern.AbstractPattern |
getSelect()
|
StylesheetEnv |
getStylesheetEnv()
Returns the StylesheetEnv |
int |
getUseCount()
|
com.caucho.xpath.expr.Var |
getVar(java.lang.String name)
Returns the value associated with name. |
int |
getVarSize()
Returns the current number of local variables. |
boolean |
hasMorePositions()
Returns true if there are more positions() needed to iterate through. |
void |
popVars(int count)
Pops the last count vars from the local stack. |
void |
setCache(java.lang.Object key,
java.lang.Object value)
|
Node |
setContextNode(Node contextNode)
Sets the context node. |
int |
setContextPosition(int position)
|
int |
setContextSize(int size)
|
void |
setCurrentNode(Node node)
Sets the current node. |
java.util.HashMap |
setFunctions(java.util.HashMap functions)
Sets the extension function library |
void |
setGlobal(java.lang.String name,
java.lang.Object value)
Sets a global variable. |
boolean |
setMorePositions(boolean more)
Set true if there are more positions() needed to iterate through. |
void |
setPosition(int position)
|
int |
setPositionIndex(int index)
|
com.caucho.xpath.pattern.AbstractPattern |
setSelect(Node node,
com.caucho.xpath.pattern.AbstractPattern select)
Sets the selection context |
void |
setStylesheetEnv(StylesheetEnv stylesheetEnv)
|
void |
setVar(java.lang.String name,
java.lang.Object value)
Sets the value associated with name. |
void |
setVarSize(int size)
Sets the current number of local variables (popping, them). |
java.lang.String |
stringValue(Node node)
Returns the string-value of the node. |
java.lang.Object |
systemProperty(java.lang.String namespaceURI,
java.lang.String localName)
Returns the given system property. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public Env()
| Method Detail |
public void setStylesheetEnv(StylesheetEnv stylesheetEnv)
public StylesheetEnv getStylesheetEnv()
ExprEnvironmentgetStylesheetEnv in interface ExprEnvironmentpublic void clear()
public int getVarSize()
public void setVarSize(int size)
public com.caucho.xpath.expr.Var getVar(java.lang.String name)
name must be interned
getVar in interface ExprEnvironment
public void addVar(java.lang.String name,
java.lang.Object value)
name must be interned
public void setVar(java.lang.String name,
java.lang.Object value)
name must be interned
public void addVar(java.lang.String name,
com.caucho.xpath.expr.Var value)
name must be interned
public void popVars(int count)
public void setGlobal(java.lang.String name,
java.lang.Object value)
public java.util.HashMap setFunctions(java.util.HashMap functions)
function - new function library
public void addFunction(java.lang.String name,
java.lang.Object fun)
function - new function librarypublic XPathFun getFunction(java.lang.String name)
getFunction in interface ExprEnvironmentpublic boolean hasMorePositions()
public boolean setMorePositions(boolean more)
more - if true, there are more positions to iterate through.public int setPositionIndex(int index)
public int getPositionIndex()
public Node getCurrentNode()
getCurrentNode in interface org.w3c.xsl.XSLTContextpublic void setCurrentNode(Node node)
public com.caucho.xpath.pattern.AbstractPattern setSelect(Node node,
com.caucho.xpath.pattern.AbstractPattern select)
public com.caucho.xpath.pattern.AbstractPattern getSelect()
public Node getContextNode()
getContextNode in interface org.w3c.xsl.XSLTContextpublic Node setContextNode(Node contextNode)
setContextNode in interface ExprEnvironmentpublic int getContextPosition()
getContextPosition in interface org.w3c.xsl.XSLTContextpublic int getContextSize()
getContextSize in interface org.w3c.xsl.XSLTContextpublic Document getOwnerDocument()
getOwnerDocument in interface org.w3c.xsl.XSLTContext
public java.lang.Object systemProperty(java.lang.String namespaceURI,
java.lang.String localName)
systemProperty in interface org.w3c.xsl.XSLTContextpublic java.lang.String stringValue(Node node)
stringValue in interface org.w3c.xsl.XSLTContextpublic void setPosition(int position)
public int setContextPosition(int position)
public int setContextSize(int size)
public java.lang.Object getCache(java.lang.Object key)
public void setCache(java.lang.Object key,
java.lang.Object value)
public int getUseCount()
public void free()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||